home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_541 / steal / src / showmenu.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  91 lines

  1. /****************************************************************************
  2.  
  3.                 ShowMenu.c
  4.  
  5.     This file should be linked together with a compiled version
  6.     of Stolen.c, or whatever it's name may be. That file must
  7.     contain the following:
  8.      - A list of Menus: Together they should be a MenuBar.
  9.     When compiling, give in an option the name of the first struct Menu
  10.     in the linked list, that is the last structure in Steal's output:
  11.         cc -Dmenu=men3 ShowMenu.c
  12.  
  13.                     Rick van Rein, October 2, 1990
  14.  
  15. ****************************************************************************/
  16.  
  17.  
  18.  
  19. #include <functions.h>
  20.  
  21. #include <Intuition/Intuition.h>
  22.  
  23.  
  24. struct IntuitionBase *IntuitionBase;
  25.  
  26.  
  27. #ifndef menu
  28.    #define menu men1
  29. #endif
  30.  
  31. extern struct Menu menu;
  32.  
  33.  
  34. /***** This routine opens a Window with a Close-Gadget in it: */
  35.  
  36.  
  37. #define BLUE_0      0
  38. #define WHITE_1     1
  39. #define BLACK_2     2
  40. #define ORANGE_3    3
  41.  
  42.  
  43. struct NewWindow closewin =
  44.  {
  45.    30,30,                    /* LeftEdge,TopEdge */
  46.    368,10,                    /* Width,Height */
  47.    BLUE_0,WHITE_1,                /* DetailPen,BlockPen */
  48.    CLOSEWINDOW,                    /* IDCMPFlags */
  49.    WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE | SMART_REFRESH | ACTIVATE,
  50.                         /* Flags */
  51.    NULL,                    /* FirstGadget */
  52.    NULL,                    /* CheckMark */
  53.    (UBYTE *) " <<< Click here to finish ShowMenu ",
  54.                         /* Title */
  55.    NULL,                    /* Screen */
  56.    NULL,                    /* BitMap */
  57.    -1,-1,                    /* MinWidth,MinHeight */
  58.    -1,-1,                    /* MaxWidth,MaxHeight */
  59.    WBENCHSCREEN                    /* Type */
  60.  };
  61.  
  62. void WaitForClick (men)
  63.  {
  64.    struct Window *win;
  65.  
  66.    if (win=OpenWindow (&closewin))
  67.     {
  68.       SetMenuStrip (win,&menu);
  69.       WaitPort (win->UserPort);
  70.       ReplyMsg (GetMsg (win->UserPort));    /* Our Gadget was Clicked */
  71.       CloseWindow (win);
  72.     }
  73.    else
  74.       puts ("\tShowMenu: Can't open Window on Workbench Screen");
  75.  }
  76.  
  77.  
  78. /***** The main routine of the showing mechanism: */
  79.  
  80. main ()
  81.  {
  82.    if (!(IntuitionBase=(struct IntuitionBase *) OpenLibrary ("intuition.library",0L)))
  83.     {
  84.       puts ("\tShowScr1: Can't open intuition.library (?)");
  85.       exit (0);
  86.     }
  87.    WaitForClick ();
  88.  
  89.    CloseLibrary (IntuitionBase);
  90.  }
  91.